<?php
include_once("config/config.inc.php");

$sql = "SELECT `shift-transaction_id`,datetime,user_id  FROM `shift-transactions` where shift = 'start' order by datetime desc ";
$res = mysql_query($sql);
//$ret = "<select name='rblshifts' id='rblshifts' onchange='myform.submit();'>";
//$ret .= "<option value=''>&nbsp;</option>";
while(list($shift_transaction_id,$datetime,$userid)=mysql_fetch_row($res))
{
	if($shiftid == $shift_transaction_id)
	{
		$select = "selected";
	}else
	{
		$select = " ";
	}
	$__sql = "SELECT user_id  FROM `shift-transactions` where shift = 'end' 
	and `datetime` > '$datetime'
	order by datetime asc 
	limit 0,1";
	$__res = mysql_query($__sql);
	list($userid)=mysql_fetch_row($__res);
	$_sql = "select fullname from users where user_id = '$userid'";
	$_res = mysql_query($_sql);
	list($username)=mysql_fetch_row($_res);
	echo "<br>$shift_transaction_id $datetime - $username $userid";
	
	if($userid) {
		/*
		$sql2 = "update fnb_sales set update_by='$userid' where update_date > '$datetime' AND update_date <'$limitdate' ";
		echo "$sql2<hr/>";
		mysql_query($sql2) or die($sql2);
		$sql2 = "update room_sales set update_by='$userid' where update_date > '$datetime' AND update_date <'$limitdate' ";
		mysql_query($sql2) or die($sql2);
		*/
		$sql3 = "update salesreceipts set update_by='$userid' where receipt_date > '$datetime' AND receipt_date <'$limitdate' ";
		mysql_query($sql3) or die($sql3);
		
		$limitdate = $datetime;
	}else{
		$limitdate = $datetime;
	}
}


 
 
?>